//
//  Matrix4.h
//  GSEngine
//
//  Created by Гукун Александр on 1/30/14.
//  Copyright (c) 2014 SNK. All rights reserved.
//

#ifndef __GSEngine__Matrix4__
#define __GSEngine__Matrix4__

#include <iostream>
#include "Matrix3.h"
// matrix3 included for determinant calculating

namespace GSEngine
{
    class mat4
    {
    public:
        // data
        union
        {
            struct
            {
                float m11, m12, m13, m14;
                float m21, m22, m23, m24;
                float m31, m32, m33, m34;
                float m41, m42, m43, m44;
            };
            float M[4][4];
            float m[16];
        };
        // methods
        // default constructor
        mat4();
        // constructor with float array
        mat4(float* array);
        // constructor with floats
        mat4(float n11, float n12, float n13, float n14,
             float n21, float n22, float n23, float n24,
             float n31, float n32, float n33, float n34,
             float n41, float n42, float n43, float n44);
        // minor
        float minor(int i, int j);
        // determinant
        float determinant();
        // set matrix identity
        void setIdentity();
        // transpose matrix
        void transpose();
        // inverse matrix
        void inverse();
        // print matrix
        void print();
        // operators
        // operator = mat4
        void operator=(mat4 matrix);
        // operator = float array
        void operator=(float* array);
        // operator * float value
        mat4 operator*(float value);
        // operator * mat4
        mat4 operator*(mat4 matrix);
        // returns pointer to float
        const float* getArrayPtr();
    };
}
#endif /* defined(__GSEngine__Matrix4__) */
